package com.swt.dao;


import com.swt.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author admin
 * @Classname UserMapper
 * @Version 1.0.0
 * @Date 2022/8/29 22:32
 */
public interface UserMapper {
    @Select("select * from user")
    List<User> getUsers();

    //方法存在多个参数，所有的参数嵌满必须加上@Param("id")
    //根据id查询
    @Select("select * from user where id=#{id}")
    User getUserById(@Param("id") int id);

    //添加数据
    @Insert("insert into user(id,name,pwd) values (#{id},#{name},#{password})")
    int addUsers(User user);

    //修改数据
    @Update("update user set name = #{name} ,pwd = #{password} where id = #{id}")
    int getUpdate(User user);

    //删除数据
    @Delete("delete from user where id = #{id}")
    int delteUserById(@Param("id") int id);
}
